Integrand size = 39, antiderivative size = 143 \[ \int \cos ^2(c+d x) (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {1}{8} a (4 A+3 (B+C)) x+\frac {a (5 A+5 B+4 C) \sin (c+d x)}{5 d}+\frac {a (4 A+3 (B+C)) \cos (c+d x) \sin (c+d x)}{8 d}+\frac {a (B+C) \cos ^3(c+d x) \sin (c+d x)}{4 d}+\frac {a C \cos ^4(c+d x) \sin (c+d x)}{5 d}-\frac {a (5 A+5 B+4 C) \sin ^3(c+d x)}{15 d} \]
1/8*a*(4*A+3*B+3*C)*x+1/5*a*(5*A+5*B+4*C)*sin(d*x+c)/d+1/8*a*(4*A+3*B+3*C) *cos(d*x+c)*sin(d*x+c)/d+1/4*a*(B+C)*cos(d*x+c)^3*sin(d*x+c)/d+1/5*a*C*cos (d*x+c)^4*sin(d*x+c)/d-1/15*a*(5*A+5*B+4*C)*sin(d*x+c)^3/d
Time = 0.44 (sec) , antiderivative size = 93, normalized size of antiderivative = 0.65 \[ \int \cos ^2(c+d x) (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {a \left (480 (A+B+C) \sin (c+d x)-160 (A+B+2 C) \sin ^3(c+d x)+96 C \sin ^5(c+d x)+15 (4 (4 A+3 (B+C)) (c+d x)+8 (A+B+C) \sin (2 (c+d x))+(B+C) \sin (4 (c+d x)))\right )}{480 d} \]
(a*(480*(A + B + C)*Sin[c + d*x] - 160*(A + B + 2*C)*Sin[c + d*x]^3 + 96*C *Sin[c + d*x]^5 + 15*(4*(4*A + 3*(B + C))*(c + d*x) + 8*(A + B + C)*Sin[2* (c + d*x)] + (B + C)*Sin[4*(c + d*x)])))/(480*d)
Time = 0.71 (sec) , antiderivative size = 133, normalized size of antiderivative = 0.93, number of steps used = 12, number of rules used = 11, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.282, Rules used = {3042, 3512, 3042, 3502, 3042, 3227, 3042, 3113, 2009, 3115, 24}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \cos ^2(c+d x) (a \cos (c+d x)+a) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (a \sin \left (c+d x+\frac {\pi }{2}\right )+a\right ) \left (A+B \sin \left (c+d x+\frac {\pi }{2}\right )+C \sin \left (c+d x+\frac {\pi }{2}\right )^2\right )dx\) |
\(\Big \downarrow \) 3512 |
\(\displaystyle \frac {1}{5} \int \cos ^2(c+d x) \left (5 a (B+C) \cos ^2(c+d x)+a (5 A+5 B+4 C) \cos (c+d x)+5 a A\right )dx+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{5} \int \sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (5 a (B+C) \sin \left (c+d x+\frac {\pi }{2}\right )^2+a (5 A+5 B+4 C) \sin \left (c+d x+\frac {\pi }{2}\right )+5 a A\right )dx+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
\(\Big \downarrow \) 3502 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \int \cos ^2(c+d x) (5 a (4 A+3 (B+C))+4 a (5 A+5 B+4 C) \cos (c+d x))dx+\frac {5 a (B+C) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \int \sin \left (c+d x+\frac {\pi }{2}\right )^2 \left (5 a (4 A+3 (B+C))+4 a (5 A+5 B+4 C) \sin \left (c+d x+\frac {\pi }{2}\right )\right )dx+\frac {5 a (B+C) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
\(\Big \downarrow \) 3227 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \left (4 a (5 A+5 B+4 C) \int \cos ^3(c+d x)dx+5 a (4 A+3 (B+C)) \int \cos ^2(c+d x)dx\right )+\frac {5 a (B+C) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \left (5 a (4 A+3 (B+C)) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx+4 a (5 A+5 B+4 C) \int \sin \left (c+d x+\frac {\pi }{2}\right )^3dx\right )+\frac {5 a (B+C) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
\(\Big \downarrow \) 3113 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \left (5 a (4 A+3 (B+C)) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx-\frac {4 a (5 A+5 B+4 C) \int \left (1-\sin ^2(c+d x)\right )d(-\sin (c+d x))}{d}\right )+\frac {5 a (B+C) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
\(\Big \downarrow \) 2009 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \left (5 a (4 A+3 (B+C)) \int \sin \left (c+d x+\frac {\pi }{2}\right )^2dx-\frac {4 a (5 A+5 B+4 C) \left (\frac {1}{3} \sin ^3(c+d x)-\sin (c+d x)\right )}{d}\right )+\frac {5 a (B+C) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
\(\Big \downarrow \) 3115 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \left (5 a (4 A+3 (B+C)) \left (\frac {\int 1dx}{2}+\frac {\sin (c+d x) \cos (c+d x)}{2 d}\right )-\frac {4 a (5 A+5 B+4 C) \left (\frac {1}{3} \sin ^3(c+d x)-\sin (c+d x)\right )}{d}\right )+\frac {5 a (B+C) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
\(\Big \downarrow \) 24 |
\(\displaystyle \frac {1}{5} \left (\frac {1}{4} \left (5 a (4 A+3 (B+C)) \left (\frac {\sin (c+d x) \cos (c+d x)}{2 d}+\frac {x}{2}\right )-\frac {4 a (5 A+5 B+4 C) \left (\frac {1}{3} \sin ^3(c+d x)-\sin (c+d x)\right )}{d}\right )+\frac {5 a (B+C) \sin (c+d x) \cos ^3(c+d x)}{4 d}\right )+\frac {a C \sin (c+d x) \cos ^4(c+d x)}{5 d}\) |
(a*C*Cos[c + d*x]^4*Sin[c + d*x])/(5*d) + ((5*a*(B + C)*Cos[c + d*x]^3*Sin [c + d*x])/(4*d) + (5*a*(4*A + 3*(B + C))*(x/2 + (Cos[c + d*x]*Sin[c + d*x ])/(2*d)) - (4*a*(5*A + 5*B + 4*C)*(-Sin[c + d*x] + Sin[c + d*x]^3/3))/d)/ 4)/5
3.4.1.3.1 Defintions of rubi rules used
Int[sin[(c_.) + (d_.)*(x_)]^(n_), x_Symbol] :> Simp[-d^(-1) Subst[Int[Exp and[(1 - x^2)^((n - 1)/2), x], x], x, Cos[c + d*x]], x] /; FreeQ[{c, d}, x] && IGtQ[(n - 1)/2, 0]
Int[((b_.)*sin[(c_.) + (d_.)*(x_)])^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d* x]*((b*Sin[c + d*x])^(n - 1)/(d*n)), x] + Simp[b^2*((n - 1)/n) Int[(b*Sin [c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n, 1] && IntegerQ[ 2*n]
Int[((b_.)*sin[(e_.) + (f_.)*(x_)])^(m_)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x _)]), x_Symbol] :> Simp[c Int[(b*Sin[e + f*x])^m, x], x] + Simp[d/b Int [(b*Sin[e + f*x])^(m + 1), x], x] /; FreeQ[{b, c, d, e, f, m}, x]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f_.)*(x_)]^2), x_Symbol] :> Simp[(-C)*Co s[e + f*x]*((a + b*Sin[e + f*x])^(m + 1)/(b*f*(m + 2))), x] + Simp[1/(b*(m + 2)) Int[(a + b*Sin[e + f*x])^m*Simp[A*b*(m + 2) + b*C*(m + 1) + (b*B*(m + 2) - a*C)*Sin[e + f*x], x], x], x] /; FreeQ[{a, b, e, f, A, B, C, m}, x] && !LtQ[m, -1]
Int[((a_.) + (b_.)*sin[(e_.) + (f_.)*(x_)])^(m_.)*((c_) + (d_.)*sin[(e_.) + (f_.)*(x_)])*((A_.) + (B_.)*sin[(e_.) + (f_.)*(x_)] + (C_.)*sin[(e_.) + (f _.)*(x_)]^2), x_Symbol] :> Simp[(-C)*d*Cos[e + f*x]*Sin[e + f*x]*((a + b*Si n[e + f*x])^(m + 1)/(b*f*(m + 3))), x] + Simp[1/(b*(m + 3)) Int[(a + b*Si n[e + f*x])^m*Simp[a*C*d + A*b*c*(m + 3) + b*(B*c*(m + 3) + d*(C*(m + 2) + A*(m + 3)))*Sin[e + f*x] - (2*a*C*d - b*(c*C + B*d)*(m + 3))*Sin[e + f*x]^2 , x], x], x] /; FreeQ[{a, b, c, d, e, f, A, B, C, m}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 - b^2, 0] && !LtQ[m, -1]
Time = 7.22 (sec) , antiderivative size = 95, normalized size of antiderivative = 0.66
method | result | size |
parallelrisch | \(\frac {a \left (3 \left (A +B +C \right ) \sin \left (2 d x +2 c \right )+\left (A +B +\frac {5 C}{4}\right ) \sin \left (3 d x +3 c \right )+\frac {3 \left (B +C \right ) \sin \left (4 d x +4 c \right )}{8}+\frac {3 \sin \left (5 d x +5 c \right ) C}{20}+3 \left (3 A +3 B +\frac {5 C}{2}\right ) \sin \left (d x +c \right )+6 x \left (A +\frac {3 B}{4}+\frac {3 C}{4}\right ) d \right )}{12 d}\) | \(95\) |
parts | \(\frac {\left (a A +B a \right ) \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3 d}+\frac {\left (B a +a C \right ) \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )}{d}+\frac {a A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}+\frac {a C \left (\frac {8}{3}+\cos ^{4}\left (d x +c \right )+\frac {4 \left (\cos ^{2}\left (d x +c \right )\right )}{3}\right ) \sin \left (d x +c \right )}{5 d}\) | \(135\) |
derivativedivides | \(\frac {\frac {a C \left (\frac {8}{3}+\cos ^{4}\left (d x +c \right )+\frac {4 \left (\cos ^{2}\left (d x +c \right )\right )}{3}\right ) \sin \left (d x +c \right )}{5}+B a \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+a C \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {a A \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {B a \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+a A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(173\) |
default | \(\frac {\frac {a C \left (\frac {8}{3}+\cos ^{4}\left (d x +c \right )+\frac {4 \left (\cos ^{2}\left (d x +c \right )\right )}{3}\right ) \sin \left (d x +c \right )}{5}+B a \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+a C \left (\frac {\left (\cos ^{3}\left (d x +c \right )+\frac {3 \cos \left (d x +c \right )}{2}\right ) \sin \left (d x +c \right )}{4}+\frac {3 d x}{8}+\frac {3 c}{8}\right )+\frac {a A \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+\frac {B a \left (2+\cos ^{2}\left (d x +c \right )\right ) \sin \left (d x +c \right )}{3}+a A \left (\frac {\cos \left (d x +c \right ) \sin \left (d x +c \right )}{2}+\frac {d x}{2}+\frac {c}{2}\right )}{d}\) | \(173\) |
risch | \(\frac {a x A}{2}+\frac {3 a B x}{8}+\frac {3 a C x}{8}+\frac {3 \sin \left (d x +c \right ) a A}{4 d}+\frac {3 a B \sin \left (d x +c \right )}{4 d}+\frac {5 a C \sin \left (d x +c \right )}{8 d}+\frac {a C \sin \left (5 d x +5 c \right )}{80 d}+\frac {\sin \left (4 d x +4 c \right ) B a}{32 d}+\frac {\sin \left (4 d x +4 c \right ) a C}{32 d}+\frac {\sin \left (3 d x +3 c \right ) a A}{12 d}+\frac {\sin \left (3 d x +3 c \right ) B a}{12 d}+\frac {5 \sin \left (3 d x +3 c \right ) a C}{48 d}+\frac {\sin \left (2 d x +2 c \right ) a A}{4 d}+\frac {\sin \left (2 d x +2 c \right ) B a}{4 d}+\frac {\sin \left (2 d x +2 c \right ) a C}{4 d}\) | \(200\) |
norman | \(\frac {\frac {a \left (4 A +3 B +3 C \right ) x}{8}+\frac {a \left (4 A +3 B +3 C \right ) \left (\tan ^{9}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4 d}+\frac {5 a \left (4 A +3 B +3 C \right ) x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8}+\frac {5 a \left (4 A +3 B +3 C \right ) x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4}+\frac {5 a \left (4 A +3 B +3 C \right ) x \left (\tan ^{6}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{4}+\frac {5 a \left (4 A +3 B +3 C \right ) x \left (\tan ^{8}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8}+\frac {a \left (4 A +3 B +3 C \right ) x \left (\tan ^{10}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{8}+\frac {a \left (12 A +13 B +13 C \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{4 d}+\frac {a \left (20 A +29 B +13 C \right ) \left (\tan ^{7}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}+\frac {4 a \left (25 A +25 B +29 C \right ) \left (\tan ^{5}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{15 d}+\frac {a \left (44 A +35 B +19 C \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{6 d}}{\left (1+\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )^{5}}\) | \(290\) |
1/12*a*(3*(A+B+C)*sin(2*d*x+2*c)+(A+B+5/4*C)*sin(3*d*x+3*c)+3/8*(B+C)*sin( 4*d*x+4*c)+3/20*sin(5*d*x+5*c)*C+3*(3*A+3*B+5/2*C)*sin(d*x+c)+6*x*(A+3/4*B +3/4*C)*d)/d
Time = 0.29 (sec) , antiderivative size = 108, normalized size of antiderivative = 0.76 \[ \int \cos ^2(c+d x) (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {15 \, {\left (4 \, A + 3 \, B + 3 \, C\right )} a d x + {\left (24 \, C a \cos \left (d x + c\right )^{4} + 30 \, {\left (B + C\right )} a \cos \left (d x + c\right )^{3} + 8 \, {\left (5 \, A + 5 \, B + 4 \, C\right )} a \cos \left (d x + c\right )^{2} + 15 \, {\left (4 \, A + 3 \, B + 3 \, C\right )} a \cos \left (d x + c\right ) + 16 \, {\left (5 \, A + 5 \, B + 4 \, C\right )} a\right )} \sin \left (d x + c\right )}{120 \, d} \]
integrate(cos(d*x+c)^2*(a+a*cos(d*x+c))*(A+B*cos(d*x+c)+C*cos(d*x+c)^2),x, algorithm="fricas")
1/120*(15*(4*A + 3*B + 3*C)*a*d*x + (24*C*a*cos(d*x + c)^4 + 30*(B + C)*a* cos(d*x + c)^3 + 8*(5*A + 5*B + 4*C)*a*cos(d*x + c)^2 + 15*(4*A + 3*B + 3* C)*a*cos(d*x + c) + 16*(5*A + 5*B + 4*C)*a)*sin(d*x + c))/d
Leaf count of result is larger than twice the leaf count of optimal. 428 vs. \(2 (134) = 268\).
Time = 0.27 (sec) , antiderivative size = 428, normalized size of antiderivative = 2.99 \[ \int \cos ^2(c+d x) (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\begin {cases} \frac {A a x \sin ^{2}{\left (c + d x \right )}}{2} + \frac {A a x \cos ^{2}{\left (c + d x \right )}}{2} + \frac {2 A a \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {A a \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {A a \sin {\left (c + d x \right )} \cos {\left (c + d x \right )}}{2 d} + \frac {3 B a x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {3 B a x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {3 B a x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {3 B a \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} + \frac {2 B a \sin ^{3}{\left (c + d x \right )}}{3 d} + \frac {5 B a \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} + \frac {B a \sin {\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{d} + \frac {3 C a x \sin ^{4}{\left (c + d x \right )}}{8} + \frac {3 C a x \sin ^{2}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{4} + \frac {3 C a x \cos ^{4}{\left (c + d x \right )}}{8} + \frac {8 C a \sin ^{5}{\left (c + d x \right )}}{15 d} + \frac {4 C a \sin ^{3}{\left (c + d x \right )} \cos ^{2}{\left (c + d x \right )}}{3 d} + \frac {3 C a \sin ^{3}{\left (c + d x \right )} \cos {\left (c + d x \right )}}{8 d} + \frac {C a \sin {\left (c + d x \right )} \cos ^{4}{\left (c + d x \right )}}{d} + \frac {5 C a \sin {\left (c + d x \right )} \cos ^{3}{\left (c + d x \right )}}{8 d} & \text {for}\: d \neq 0 \\x \left (a \cos {\left (c \right )} + a\right ) \left (A + B \cos {\left (c \right )} + C \cos ^{2}{\left (c \right )}\right ) \cos ^{2}{\left (c \right )} & \text {otherwise} \end {cases} \]
Piecewise((A*a*x*sin(c + d*x)**2/2 + A*a*x*cos(c + d*x)**2/2 + 2*A*a*sin(c + d*x)**3/(3*d) + A*a*sin(c + d*x)*cos(c + d*x)**2/d + A*a*sin(c + d*x)*c os(c + d*x)/(2*d) + 3*B*a*x*sin(c + d*x)**4/8 + 3*B*a*x*sin(c + d*x)**2*co s(c + d*x)**2/4 + 3*B*a*x*cos(c + d*x)**4/8 + 3*B*a*sin(c + d*x)**3*cos(c + d*x)/(8*d) + 2*B*a*sin(c + d*x)**3/(3*d) + 5*B*a*sin(c + d*x)*cos(c + d* x)**3/(8*d) + B*a*sin(c + d*x)*cos(c + d*x)**2/d + 3*C*a*x*sin(c + d*x)**4 /8 + 3*C*a*x*sin(c + d*x)**2*cos(c + d*x)**2/4 + 3*C*a*x*cos(c + d*x)**4/8 + 8*C*a*sin(c + d*x)**5/(15*d) + 4*C*a*sin(c + d*x)**3*cos(c + d*x)**2/(3 *d) + 3*C*a*sin(c + d*x)**3*cos(c + d*x)/(8*d) + C*a*sin(c + d*x)*cos(c + d*x)**4/d + 5*C*a*sin(c + d*x)*cos(c + d*x)**3/(8*d), Ne(d, 0)), (x*(a*cos (c) + a)*(A + B*cos(c) + C*cos(c)**2)*cos(c)**2, True))
Time = 0.21 (sec) , antiderivative size = 166, normalized size of antiderivative = 1.16 \[ \int \cos ^2(c+d x) (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=-\frac {160 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} A a - 120 \, {\left (2 \, d x + 2 \, c + \sin \left (2 \, d x + 2 \, c\right )\right )} A a + 160 \, {\left (\sin \left (d x + c\right )^{3} - 3 \, \sin \left (d x + c\right )\right )} B a - 15 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} B a - 32 \, {\left (3 \, \sin \left (d x + c\right )^{5} - 10 \, \sin \left (d x + c\right )^{3} + 15 \, \sin \left (d x + c\right )\right )} C a - 15 \, {\left (12 \, d x + 12 \, c + \sin \left (4 \, d x + 4 \, c\right ) + 8 \, \sin \left (2 \, d x + 2 \, c\right )\right )} C a}{480 \, d} \]
integrate(cos(d*x+c)^2*(a+a*cos(d*x+c))*(A+B*cos(d*x+c)+C*cos(d*x+c)^2),x, algorithm="maxima")
-1/480*(160*(sin(d*x + c)^3 - 3*sin(d*x + c))*A*a - 120*(2*d*x + 2*c + sin (2*d*x + 2*c))*A*a + 160*(sin(d*x + c)^3 - 3*sin(d*x + c))*B*a - 15*(12*d* x + 12*c + sin(4*d*x + 4*c) + 8*sin(2*d*x + 2*c))*B*a - 32*(3*sin(d*x + c) ^5 - 10*sin(d*x + c)^3 + 15*sin(d*x + c))*C*a - 15*(12*d*x + 12*c + sin(4* d*x + 4*c) + 8*sin(2*d*x + 2*c))*C*a)/d
Time = 0.33 (sec) , antiderivative size = 129, normalized size of antiderivative = 0.90 \[ \int \cos ^2(c+d x) (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {1}{8} \, {\left (4 \, A a + 3 \, B a + 3 \, C a\right )} x + \frac {C a \sin \left (5 \, d x + 5 \, c\right )}{80 \, d} + \frac {{\left (B a + C a\right )} \sin \left (4 \, d x + 4 \, c\right )}{32 \, d} + \frac {{\left (4 \, A a + 4 \, B a + 5 \, C a\right )} \sin \left (3 \, d x + 3 \, c\right )}{48 \, d} + \frac {{\left (A a + B a + C a\right )} \sin \left (2 \, d x + 2 \, c\right )}{4 \, d} + \frac {{\left (6 \, A a + 6 \, B a + 5 \, C a\right )} \sin \left (d x + c\right )}{8 \, d} \]
1/8*(4*A*a + 3*B*a + 3*C*a)*x + 1/80*C*a*sin(5*d*x + 5*c)/d + 1/32*(B*a + C*a)*sin(4*d*x + 4*c)/d + 1/48*(4*A*a + 4*B*a + 5*C*a)*sin(3*d*x + 3*c)/d + 1/4*(A*a + B*a + C*a)*sin(2*d*x + 2*c)/d + 1/8*(6*A*a + 6*B*a + 5*C*a)*s in(d*x + c)/d
Time = 2.79 (sec) , antiderivative size = 279, normalized size of antiderivative = 1.95 \[ \int \cos ^2(c+d x) (a+a \cos (c+d x)) \left (A+B \cos (c+d x)+C \cos ^2(c+d x)\right ) \, dx=\frac {\left (A\,a+\frac {3\,B\,a}{4}+\frac {3\,C\,a}{4}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^9+\left (\frac {10\,A\,a}{3}+\frac {29\,B\,a}{6}+\frac {13\,C\,a}{6}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^7+\left (\frac {20\,A\,a}{3}+\frac {20\,B\,a}{3}+\frac {116\,C\,a}{15}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^5+\left (\frac {22\,A\,a}{3}+\frac {35\,B\,a}{6}+\frac {19\,C\,a}{6}\right )\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^3+\left (3\,A\,a+\frac {13\,B\,a}{4}+\frac {13\,C\,a}{4}\right )\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}{d\,\left ({\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^{10}+5\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^8+10\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^6+10\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^4+5\,{\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )}^2+1\right )}-\frac {a\,\left (\mathrm {atan}\left (\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\right )-\frac {d\,x}{2}\right )\,\left (4\,A+3\,B+3\,C\right )}{4\,d}+\frac {a\,\mathrm {atan}\left (\frac {a\,\mathrm {tan}\left (\frac {c}{2}+\frac {d\,x}{2}\right )\,\left (4\,A+3\,B+3\,C\right )}{4\,\left (A\,a+\frac {3\,B\,a}{4}+\frac {3\,C\,a}{4}\right )}\right )\,\left (4\,A+3\,B+3\,C\right )}{4\,d} \]
(tan(c/2 + (d*x)/2)*(3*A*a + (13*B*a)/4 + (13*C*a)/4) + tan(c/2 + (d*x)/2) ^9*(A*a + (3*B*a)/4 + (3*C*a)/4) + tan(c/2 + (d*x)/2)^7*((10*A*a)/3 + (29* B*a)/6 + (13*C*a)/6) + tan(c/2 + (d*x)/2)^3*((22*A*a)/3 + (35*B*a)/6 + (19 *C*a)/6) + tan(c/2 + (d*x)/2)^5*((20*A*a)/3 + (20*B*a)/3 + (116*C*a)/15))/ (d*(5*tan(c/2 + (d*x)/2)^2 + 10*tan(c/2 + (d*x)/2)^4 + 10*tan(c/2 + (d*x)/ 2)^6 + 5*tan(c/2 + (d*x)/2)^8 + tan(c/2 + (d*x)/2)^10 + 1)) - (a*(atan(tan (c/2 + (d*x)/2)) - (d*x)/2)*(4*A + 3*B + 3*C))/(4*d) + (a*atan((a*tan(c/2 + (d*x)/2)*(4*A + 3*B + 3*C))/(4*(A*a + (3*B*a)/4 + (3*C*a)/4)))*(4*A + 3* B + 3*C))/(4*d)